impl Solution {
    pub fn compress_string(s: String) -> String {
        if s.len()==0{
            return "".to_string();
        }
        let mut s_iter =s.bytes();
        let mut last_byte=s_iter.next().unwrap();
        let mut num=1;
        let mut ans=String::new();
        for b in s_iter{
            if b!=last_byte{
                ans.push(last_byte.into());
                last_byte=b;
                ans.push_str(&num.to_string());
                num=1;
            }else{
                num+=1;
            }
        };
        ans.push(last_byte.into());
        ans.push_str(&num.to_string());
        if ans.len()>=s.len(){
            s
        }else{
            ans
        }
    }
}
